<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=utf-8" errorPage="/error.jsp" isELIgnored="false" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://www.opensymphony.com/oscache" prefix="cache" %>
<%@ taglib uri="http://atleap.blandware.com/taglib" prefix="atleap" %>
<html:xhtml />

<atleap:constants className="com.blandware.atleap.webapp.util.core.WebappConstants" var="CONTENT_LOCALES_COLLECTION_KEY" scope="page" />
<tiles:importAttribute ignore="true"/>
<c:if test="${exceptionCheckboxes == null}">
    <c:set var="exceptionCheckboxes" value="null" />
</c:if>
<h3>
    <atleap:message key="${listTitleKey}" />
</h3>
<atleap:constants className="com.blandware.atleap.webapp.util.core.WebappConstants" var="GRID_PAGE_SIZE" />
<atleap:constants className="com.blandware.atleap.webapp.util.core.WebappConstants" var="CONTENT_FIELD_VALUES_COLLECTION_KEY" />
<atleap:constants className="com.blandware.atleap.webapp.util.core.WebappConstants" var="SELECT_ALL_LOCALES_CHECKBOX_IS_CHECKED" scope="page" />
<c:set var="multipleDisabled" value="false" />
<atleap:grid name="localesGrid" pageSize="${1000}">
    <atleap:message key="${nothingCheckedErrorKey}" var="errorMessage" />
    <atleap:queryParameter name="id" value="${param.id}" />
        <table border="0" cellpadding="0" cellspacing="0" class="grid">
            <thead>
                <tr nowrap="nowrap">
                    <th align="center" class="checkbox">
                        <input type="checkbox" id="toggleAll" onclick="toggleAllCheckBoxes(this.form, this.id, ${exceptionCheckboxes});" <c:if test="${requestScope[SELECT_ALL_LOCALES_CHECKBOX_IS_CHECKED]}">checked="checked"</c:if>/>
                    </th>
                    <th nowrap="nowrap">
                        <atleap:message key="${languageKey}" />
                    </th>
                 </tr>
            </thead>
            <tbody>
                <atleap:rowsIterator collection="${sessionScope[pageScope.CONTENT_LOCALES_COLLECTION_KEY]}"  var="contentLocale" oddClass="oddRow" evenClass="evenRow">
                    <tr class="${rowClass}">
                        <td align="center" class="defaultCursorCell"><html:checkbox property="${checkedBoxProperty}(${contentLocale.identifier})" /></td>
                        <td class="defaultCursorCell">
                            <atleap:fieldValue valueMap="${contentLocale.title}" var="languageTitle" />
                            <c:if test="${empty languageTitle}">
                                <c:set var="languageTitle" value="${contentLocale.identifier}" />
                            </c:if>
                            ${languageTitle}
                        </td>
                    </tr>
                </atleap:rowsIterator>
                <atleap:noRows>
                    <c:set var="multipleDisabled" value="true" />
                    <tr>
                        <td class="tfoot" colspan="6" align="center">
                            <em><atleap:message key="core.commons.nothingToShow"/></em>
                        </td>
                    </tr>
                </atleap:noRows>
            </tbody>
        </table>
</atleap:grid>
<br />
